講完了 Google Sheet, 接下來就是來學會操作 Google Slide 啦
首先跟大家說明一下 Google Slides 的架構!
那先來講講 Presentation  跟 Slide 的用法與差異吧!
Presentation 代表整個 Google 投影片簡報,可使用這個物件來存取和管理整個 Presentation 簡報
那如何用 GAS 建立與開啟一個 google slide 簡報檔案呢?
create()function createNewPresentation() {
  var presentation = SlidesApp.create("My New Presentation");
  Logger.log("New Presentation ID: " + presentation.getId());
}
openById()  var presentationId = "YOUR_PRESENTATION_ID"; // 替換為實際簡報ID (可從網址看到ID)
  var presentation = SlidesApp.openById(presentationId);
openByUrl()var presentation = SlidesApp.openByUrl('https://docs.google.com/presentation/d/docId/edit');
getActivePresentation()// Get the current presentation to which this script is bound.
var presentation = SlidesApp.getActivePresentation();
範例:建立一個簡報,標題為 GAS 鐵人賽

function listSlidesInPresentation() {
  var presentation = SlidesApp.getActivePresentation(); // 獲取目前開啟的簡報
  var presentationTitle = presentation.getName(); // 獲取簡報的標題
}

function addTitleAndSubtitleToSlide() {
  var presentation = SlidesApp.getActivePresentation();
  var slide = presentation.getSlides()[0]; // 取得第一張 Slide
  
  // 插入標題和副標題
  slide.insertTextBox('標題文字', 100, 100, 400, 50);
  slide.insertTextBox('副標題文字', 100, 200, 400, 50); 
  Logger.log('已在第一張 slide 新增標題和副標題');
}

明天讓我們來詳細看看 PageElement (頁面元素) 和 Shape (形狀) 吧!